# https://leetcode-cn.com/problems/check-if-one-string-swap-can-make-strings-equal/
from collections import Counter

class Solution:
    def areAlmostEqual(self, s1: str, s2: str) -> bool:
        if Counter(s1) != Counter(s2):
            return False
        diff_num = 0
        for ch1, ch2 in zip(s1, s2):
            if ch1 != ch2:
                diff_num += 1
        return diff_num == 0 or diff_num == 2